package com.sunstar.koobaselib.kootl.usercenter.helper;

import com.sunstar.koobaselib.kootl.comm.helper.CacheHelper;
import com.sunstar.koobaselib.kootl.usercenter.bean.UserLoginBean;

/**
 * Created by louisgeek on 2017/1/19.
 */

public class UserLoginHelper {
    private static String SAVE_USER_CACHE = "saveUserCache";

    public static boolean hasUserLoginInfo() {
        boolean hasLogin;
        UserLoginBean userLoginBean = CacheHelper.getData(SAVE_USER_CACHE);
        if (userLoginBean == null || !userLoginBean.getResult_code().equals("100")) {
            //未登录
            hasLogin=false;
        } else {
            hasLogin=true;
        }
        return hasLogin;
    }
    public static UserLoginBean getUserLoginInfo() {
        UserLoginBean userLoginBean = CacheHelper.getData(SAVE_USER_CACHE);
        return userLoginBean;
    }

    public static void saveUserLoginInfo(UserLoginBean userLoginBean) {
        CacheHelper.putData(SAVE_USER_CACHE, userLoginBean);
    }
    public static void deleteUserLoginInfo() {
        CacheHelper.remove(SAVE_USER_CACHE);
    }
}
